/**
 * 阅读记录相关API类型定义
 */

import type { TimestampInfo } from './common'

// 阅读记录创建请求
export interface ReadingRecordCreateReqVO {
  bookId: number
  planId?: number
  lastPage: number
  readingProgress: number
  readingTime: number
  readingMode: string
  isCompleted: boolean
}

// 阅读记录响应
export interface ReadingRecordRespVO extends TimestampInfo {
  id: number
  userId: number
  bookId: number
  planId?: number
  isCompleted: boolean
  readingProgress: number
  lastPage: number
  readingTime: number
  readingMode: string
  firstReadAt: string
  lastReadAt: string
  completedAt?: string
}

// 最近阅读响应
export interface RecentReadingRespVO {
  bookSetId: number
  bookSetTitle: string
  cover: string // 修复字段名：与后端保持一致
  bookCount: number
  source?: string // 来源标签
  lastReadAt: string // 修复字段名：与后端保持一致
  readProgress: number // 修复字段名：与后端保持一致
  readBooks?: number
}

// 今日阅读响应
export interface TodayReadingRespVO {
  totalBooks: number
  completedBooks: number
  totalReadingTime: number
  booksRead: RecentReadingRespVO[]
  readingGoal?: number
  goalProgress?: number
}

// 阅读统计响应
export interface ReadingStatsRespVO {
  totalBooks: number
  completedBooks: number
  totalReadingTime: number
  averageReadingTime: number
  streakDays: number
  thisWeekBooks: number
  thisMonthBooks: number
  favoriteCategory: string
  readingLevel: number
}

// 阅读历史参数
// 阅读历史响应
export interface ReadingHistoryRespVO extends TimestampInfo {
  id: number
  bookId: number
  bookTitle: string
  bookCover: string
  bookLanguage?: string
  bookSetId?: number
  bookSetTitle?: string
  isCompleted: boolean
  readingProgress: number
  lastPage?: number
  readingTime: number
  readingMode?: string
  firstReadAt: string
  lastReadAt: string
  completedAt?: string
}

export interface ReadingHistoryParams {
  page?: number
  size?: number
  lang?: string
  categoryId?: number
  isCompleted?: boolean
  startDate?: string
  endDate?: string
}
